package work.huangxin.share.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import work.huangxin.share.basemapper.SameService;
import work.huangxin.share.mapper.NoticeMessageMapper;
import work.huangxin.share.domain.other.NoticeMessage;

import javax.annotation.Resource;
import java.util.List;

@Service
public class NoticeOperationService extends SameService<NoticeMessage> {


    @Resource
    private NoticeMessageMapper noticeMessageMapper;


    public PageInfo<NoticeMessage> getAllNoticeById(Integer userId, Integer pageNumber) {
        PageHelper.startPage(pageNumber, 15);
        return new PageInfo<NoticeMessage>(noticeMessageMapper.getAllNoticeById(userId));
    }


    public PageInfo<NoticeMessage> getReportArticleByTypeId(Integer pageNo, Integer pageSize, int i) {
        PageHelper.startPage(pageNo, pageSize);
        List<NoticeMessage> noticeMessageList = noticeMessageMapper.getReportByTypeId(i);
        PageInfo<NoticeMessage> of = PageInfo.of(noticeMessageList);
        return of;

    }
}
